package com.itheima.stock.job;

import com.itheima.stock.service.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class StockJob {

    @Autowired
    private StockTimerTaskService stockTimerTaskService;

    @XxlJob("myJobHandler")
    public void myJobHandler() throws Exception{
        System.out.println("当前时间为"+ DateTime.now().toString("yyyy-MM-dd HH:mm:ss"));
    }


    /**
     * 定时采集a股大盘数据
     * @throws Exception
     */
    @XxlJob("getInnerMarketInfo")
    public void getInnerMarketInfo() throws Exception{
        stockTimerTaskService.getInnerMarketInfo();
    }
    /**
     * 定时采集个股板块数据
     * @throws Exception
     */
    @XxlJob("getStockRtIndex")
    public void getStockRtIndex() throws Exception{
        stockTimerTaskService.getStockRtIndex();
    }
    /**
     * 定时采集a股板块数据
     * @throws Exception
     */
    @XxlJob("getBlockRtInfo")
    public void getBlockRtInfo() throws Exception{
        stockTimerTaskService.getBlockRtInfo();
    }
    /**
     * 定时采集a股外盘数据
     * @throws Exception
     */
    @XxlJob("getOuterMarketInfo")
    public void getOuterMarketInfo() throws Exception{
        stockTimerTaskService.getOuterMarketInfo();
    }

}
